import time
from selenium.webdriver.common.by import By
from Page.page import Page
class Page2(Page):
    #点击首页
    home_loc=(By.XPATH,'/html/body/div[3]/div[2]/ul/li[1]/a')
    #点击商品
    clickshop_loc=(By.XPATH,'/html/body/div[8]/div[1]/div[2]/div[2]/ul/li[4]/div[1]/a/img')
    # 点击加入购物车
    gwc_loc=(By.XPATH,'//*[@id="add-cart"]')
#     查看购物车
    seegwc_loc=(By.XPATH,'/html/body/div[3]/div[3]/div[2]/a')
#     勾选商品
    gxshop_loc=(By.XPATH,'//*[@id="cart-box"]/div[1]/table/tbody/tr[2]/td[1]/input')
    # 点击结算
    jieshuan_loc=(By.XPATH,'//*[@id="cartForm"]/div[2]/div/a[2]')

    next_loc = (By.ID, 'order-button')

    def home(self):
        self.find_element(self.home_loc).click()

    def clickshop(self):
        self.find_element(self.clickshop_loc).click()

    def gwc(self):
        self.find_element(self.gwc_loc).click()

    def seegwc(self):
        self.find_element(self.seegwc_loc).click()

    def gxshop(self):
        self.find_element(self.gxshop_loc).click()

    def jieshuan(self):
        self.find_element(self.jieshuan_loc).click()

    def next(self):
        self.find_element(self.next_loc).click()

    def a3mall_luoji2(self):
        self.a3mall_luoji('18986670716','a123456')
        time.sleep(2)
        self.home()
        self.scroll_to_element('500')
        self.clickshop()
        time.sleep(3)
        self.gwc()
        time.sleep(3)
        self.seegwc()
        self.gxshop()
        self.jieshuan()
        self.next()









